package 练习.双向排序;

import java.util.Arrays;
import java.util.Scanner;

public class test {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = i+1;
		}
		for (int i = 0; i < n; i++) {
			int caozuo = scanner.nextInt();
			int weizhi = scanner.nextInt();

			if (caozuo == 0){
				Arrays.sort(a,0,weizhi);
				for (int j = 0 , j2 = weizhi - 1 ; j < j2; j++ , j2--) {
					int temp = a[j];
					a[j] = a[j2];
					a[j2] = temp;
				}
			}

			if (caozuo == 1){
				Arrays.sort(a,weizhi-1,n);
			}
		}

		for (int res :a) {
			System.out.print(res+" ");
		}
	}
}
